﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Game1942.Library.Background;

namespace Game1942.Library.FlightPlans
{
    public class DiagonalStrategy : FlightPlan
    {
        protected int cycle;
        private int cycleCounter;
        protected int currentSense = 1;

        public DiagonalStrategy(int speed, int aCycle): this(speed)
        {
            cycle = aCycle;
        }

        public DiagonalStrategy(int speed)
        {
            if (speed == 1)
            {
                this.speed = 1;
            }
            else
            {
                this.speed = (int)(speed / Math.Sqrt(2));
            }
        }

        public void UpdateSense()
        {
            cycleCounter++;
            if (cycleCounter == cycle)
            {
                currentSense *= -1;
                cycleCounter = 0;
            }
        }
    }
}
